/// print for debug
/// works only in debug mode
/// 
/// # Examples
/// 
/// ```rust
/// use meth_tools::debug_print;
/// debug_print!("hello world");
/// debug_print!("{} + {} = {}", 1, 2, 1 + 2);
/// ```
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! debug_print {
    () => {};
    ($($arg:tt)*) => {{
        print!($($arg)*);
    }};
}
#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! debug_print {
    () => {};
    ($($arg:tt)*) => {};
}

/// println for debug
/// works only in debug mode
/// 
/// # Examples
/// 
/// ```rust
/// use meth_tools::debug_println;
/// debug_println!("hello world");
/// debug_println!("{} + {} = {}", 1, 2, 1 + 2);
/// ```
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! debug_println {
    () => {{println!();}};
    ($($arg:tt)*) => {{
        println!($($arg)*);
    }};
}

#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! debug_println {
    () => {};
    ($($arg:tt)*) => {};
}

/// do for debug
/// wrap the code so that it runs only under debug mode
/// will generate a new block
/// 
/// # Examples
/// 
/// ```rust
/// use meth_tools::debug_do;
/// let mut a = 0;
/// debug_do!(
///     for _ in 0..8 {
///         a += 1;
///     }
/// );
/// // a is 8 in debug mode
/// // a is 0 in release mode
/// println!("{a}");
/// ```
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! debug_do {
    ($($any:tt)*) => {
        {
            $($any)*
        }
    }
}
#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! debug_do {
    ($($any:tt)*) => {}
}
